package host.haiwai.mapstruct;

import host.haiwai.entity.Menu;
import host.haiwai.vo.MenuListVo;
import host.haiwai.vo.MenuVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Mapstruct 转换pojo转vo工具类
 */
@Mapper
public interface MenuListMapstruct {
    MenuListMapstruct mapper = Mappers.getMapper(MenuListMapstruct.class);

    @Mappings({
            @Mapping(source = "menuName",target = "menuName"),
            @Mapping(source = "menuLink",target = "menuLink"),
            @Mapping(source = "menuIco",target = "menuIco"),
            @Mapping(source = "menuAuthority",target = "menuAuthority"),
            @Mapping(source = "menuSort",target = "menuSort")
    })
    MenuListVo menuListPojo2Vo(Menu menu);

    List<MenuListVo> menuListList2Vo(List<Menu> list);
}
